import java.util.*;


public class Question25 {
    /**
     * 代码中的类名、方法名、参数名已经指定，请勿修改，直接返回方法规定的值即可
     *
     * 
     * @param nums int整型一维数组 
     * @param k int整型 
     * @return int整型
     */
    public int maximumProduct (int[] nums, int k) {
        // write code here

        int ret = 1;
        int len = nums.length;

        long[] temp = new long[len];
        for (int i = 0; i < len; i++) {
            temp[i] = nums[i];
        }

        for (int i = 0; i < k; i++) {
            Arrays.sort(temp);
            temp[0]++;

            // System.out.println(Arrays.toString(nums));
        }

        for (long i : temp) {
            ret = (int)(ret * i % 1000000007);
        }

        return ret;
    }
}